from django.contrib.auth.models import AbstractUser
from django.db import models


# 用户信息
class user(models.Model):
    class Meta:
        db_table = "user"
        verbose_name = "用户基础信息表"
        # 指定了verbose_name_plural页面会显示这个名，不指定会显示verbose_name名并且后面拼接一个s
        verbose_name_plural = "用户基础信息表"
    id = models.BigIntegerField(primary_key=True, auto_created=True, db_comment='用户id，主键')
    role_id = models.BigIntegerField(db_comment='角色id')
    user_no = models.CharField(max_length=50, default="", db_comment="用户工号")
    password = models.CharField(max_length=255, db_comment="用户登录密码")
    user_name = models.CharField(max_length=100, db_comment="用户姓名")
    email = models.CharField(max_length=100, db_comment="用户邮箱")
    phone = models.CharField(max_length=45, db_comment="用户电话")
    status = models.IntegerField(default=0, db_comment="用户状态 0:正常 1:异常")
    create_date = models.DateTimeField(auto_now_add=True, db_comment="创建时间")
    create_user = models.CharField(max_length=255, db_comment="创建人工号")
    update_date = models.DateTimeField(auto_now_add=True, db_comment="修改时间")
    update_user = models.CharField(max_length=255, db_comment="修改人工号")
    version = models.IntegerField(default=0, db_comment="版本号，乐观锁")

    def __str__(self):
        return self.user_name
